/*
*
*   Generated by javascript
*   @file jquery.browser
*   @author TimYao <tmwoman@yeah.net>
*   @version 20160325
*
*   bug repair
*   jquery
*
*    version>=1.9 last version   $.browser
*
*     浏览器验证$.browser
*
* */

(function($,global){
    if($===global.jQuery)
    {
        if($.browser || $.httpData || $.handleError)
        {
            return false;
        }
    }
    $.browser = (function(){
        var browser_v = {},
            P,
            browsers = navigator.userAgent;
        var uaMatch=function(a) {
            a = a.toLowerCase();
            a = /(webkit)[ \/]([\w.]+)/.exec(a) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a) || /(msie) ([\w.]+)/.exec(a) || !/compatible/.test(a) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(a) || [];
            return {
                browser: a[1] || "",
                version: a[2] || "0"
            }
        };
        P = uaMatch(browsers);
        if(P.browser)
        {
            browser_v[P.browser] = true;
            browser_v['version'] = P.version;
        }
        if(browser_v.webkit)
        {
            browser_v.safari = P.browser.safari = true;
        }
        return browser_v;
    })();

	// handleError  httpData 修复
	 jQuery.extend({
	     handleError: function (s, xhr, status, e) {
	         if (s.error) {
	             s.error.call(s.context || s, xhr, status, e);
	         }
	         if (s.global) {
	             (s.context ? jQuery(s.context) : jQuery.event).trigger("ajaxError", [xhr, s, e]);
	         }
	     },
	     httpData: function (xhr, type, s) {
	         var ct = xhr.getResponseHeader("content-type"),
			 xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
			 data = xml ? xhr.responseXML : xhr.responseText;
			         if (xml && data.documentElement.tagName == "parsererror")
			             throw "parsererror";
			         if (s && s.dataFilter)
			             data = s.dataFilter(data, type);
			         if (typeof data === "string") {
			             if (type == "script")
			                 jQuery.globalEval(data);
			             if (type == "json")
			                 data = window["eval"]("(" + data + ")");
			         }
			         return data;
		  }
	 });
})(jQuery,window);